package com.ruoyi.business.publisher;

import com.ruoyi.business.constant.TradeConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class MessagePublisher {

    private final StringRedisTemplate stringRedisTemplate;

    @Autowired
    public MessagePublisher(StringRedisTemplate stringRedisTemplate) {
        this.stringRedisTemplate = stringRedisTemplate;
    }

    public void publish( String message) {
        stringRedisTemplate.convertAndSend(TradeConstants.TICKET_CHANNEL, message);
    }
}
